package com.vint.leetcode;

import java.util.ArrayList;
import java.util.List;

public class Leetcode473 {
	public static int leastN(int n){

		int start = 2;
		int end = n + 1;
		for(int i = 2; i <= n+1; i++){
			if(sameBit(n,i))
				return i;
		}
		return n + 1;
	}

	public static boolean sameBit(int n, int k){
		int bit = n % k;
		while(n!=0){
			if(n%k!=bit)return false;
			n = n / k;
			if(n==0)break;
		}
		return true;
	}
	public static void main(String[] args){
		System.out.println(leastN(8));
		List<List<Integer>> nd = new ArrayList<>();
	}
}
